#!/bin/env python3
#coding=utf-8
import sys
from lib.bottle import route, request
from main.loginManager.database.read import readMode
import time

@route('/api/info')
def hello():
    dbs = readMode()
    select = [
        'unitid',
        'nickname'
    ]
    data = dbs.select(select, None, 'users', False)
    return data

@route('/api/insert')
def lala():
    dbs = readMode()
    insdata = {
        'unitid': 'asdqwwq2333ss',
        'nickname': 'adww',
        'password': 'd32r2fqwdw',
        'levels': '4',
        'intime': '2017-04-01 22:22:22'
    }
    if dbs.insert(insdata, 'users'):
        return "done"
    return "nonono"

@route('/api/test')
def test():
    dbs = readMode()
    dbs.test()
    return '111'
